<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('schedule','IndexController@schedule');
Route::any('wechat',   'WechatController@serve');
Route::any('create-menu',   'WechatController@createMenu');

Route::any('upload','UploadController@upload');


Route::get('logout',   'LoginController@logOut');

Route::get('rent-info',	   'IndexController@rentInfo');

Route::middleware(['wechat.oauth'])->group(function(){
	Route::get('login',    'LoginController@login');
 	Route::any('logindo', 'LoginController@loginDo');
});




Route::middleware(['web','wechat.oauth:snsapi_userinfo'])->prefix('user')->namespace('User')->group(function(){

	Route::get('booking-add',  		'BookingController@add');
	Route::post('booking-save',		'BookingController@save');
	Route::get('booking-show/{id}', 'BookingController@show');
	Route::prefix('task')->group(function(){
		Route::get('create', 'TaskController@create');
		Route::post('save',  'TaskController@save');
		Route::any('complete','TaskController@complete');
		Route::get('show/{id}',  'TaskController@show');
		Route::get('edit/{id}',  'TaskController@edit');
		Route::post('update',     'TaskController@update');
		Route::any('reply',       'TaskController@reply');
		Route::any('process',       'TaskController@process');
		Route::any('process-price', 'TaskController@processPrice');	
		Route::get('price-detail/{id}',  'TaskController@priceDetail');		
		Route::any('price-confirmed','TaskController@priceConfirmed');
		
		

		Route::any('comment',       'TaskController@comment');
		Route::any('comment-save',  'TaskController@commentSave');
		Route::any('refund',      'TaskController@refund');
		Route::any('/',		      'TaskController@index');	
	});

	Route::prefix('dashboard')->group(function(){
		Route::get('create', 'DashboardController@create');
		Route::any('save',  'DashboardController@save');
		Route::any('complete','DashboardController@complete');
		Route::get('show/{id}',  'DashboardController@show');
		Route::get('edit/{id}',  'DashboardController@edit');
		Route::any('update',     'DashboardController@update');
		Route::any('reply',       'DashboardController@reply');
		Route::any('process',       'DashboardController@process');
		
		

		
		Route::any('/',		      'DashboardController@index');	
	});


	Route::prefix('depart')->group(function(){
		Route::get('info', 		'DepartController@info');
		Route::post('save-out', 'DepartController@saveOut');
		Route::any('/',		    'DepartController@index');	
	});
	
	Route::get('/',        'IndexController@index');
});

Route::prefix('zadmin')->namespace('Admin')->group(function(){
	Route::middleware('checkAdmin')->group(function(){
		Route::get('conver-task','IndexController@convertTask');
		Route::get('system-info','SystemController@info');
		Route::get('system-update','SystemController@update');
		Route::prefix('task')->group(function(){
			
			Route::get('change-status','TaskController@changeStatus');
			Route::get('edit/{id}',  'TaskController@edit');
			Route::get('show/{id}',  'TaskController@show');
			Route::get('print/{id}',  'TaskController@print');
			Route::post('update/{id}', 'TaskController@update');
			Route::any('complete',	'TaskController@complete');
			Route::get('add',        'TaskController@add');
			Route::post('save',      'TaskController@save');
			Route::get('buyer-task/{task_id}',   'TaskController@buyerTask');
			Route::get('del/{id}',   'TaskController@del');

			// 导出
			Route::any('export','TaskController@taskExport');
			
			// 回复任务
			Route::any('reply', 'TaskController@reply');

			// 单独添加服务项目
			Route::post('save-service','TaskController@saveService');
			Route::get('del-service','TaskController@delService');

			// 单独添加配件
			Route::post('save-depart','TaskController@saveDepart');
			Route::get('del-depart','TaskController@delDepart');

			Route::get('/','TaskController@index');
		});

		Route::resource('product',    'ProductController');
		Route::resource('admins',     'AdminController');
		Route::resource('users',      'UserController');
		Route::resource('roles',      'RoleController');
		Route::resource('menus',      'MenuController');
		Route::prefix('booking')->group(function(){
			Route::get('edit/{id}',   'BookigServiceController@edit');
			Route::post('update/{id}','BookigServiceController@update');
			Route::get('del/{id}',    'BookigServiceController@del');
			Route::get('/',           'BookigServiceController@index');
		});

		// 导出
		Route::any('dashboard/export',   'DashboardController@export');
		Route::any('dashboard/process',  'DashboardController@process');
		Route::resource('dashboard',    'DashboardController');
		

		// 客户信息
		Route::resource('clients',    'ClientController');
		Route::post('clients/import', 'ClientController@import');
		Route::post('clients/export', 'ClientController@export');

		Route::resource('client-users',    'ClientUserController');
		// 采购信息
		Route::resource('purchases',  'PurchaseController');

		// 供应商
		Route::resource('supplies',     'SupplyController');

		// 投诉建议（吐槽）
		Route::get('suggest',		  'SuggestController@index');
		Route::get('suggest/del/{id}','SuggestController@del');

		// 合作伙伴
		Route::resource('parters',      'ParterController');
		Route::resource('services',     'ServiceController');
		Route::post('services/import',  'ServiceController@import');
		Route::post('services/bath-del','ServiceController@bathDel');
		Route::any('services/export','ServiceController@serviceExport');	

		Route::resource('service-type','ServiceTypeController');

		Route::any('cars/export',     'CarController@carExport');
		Route::post('cars/batch-del',     'CarController@batchDel');
		Route::resource('cars',       'CarController');
		Route::resource('car-brands',       'CarBrandController');
		Route::resource('car-series',       'CarSerieController');
		Route::resource('car-models',       'CarModelController');
		Route::resource('departcates','DepartCateController');
		Route::resource('departlogs', 'DepartLogController');
		Route::get('menus/permission/{menu_id}', 'MenuController@menuPermission');
		Route::resource('permissions', 'PermissionController');	
		Route::resource('category',   'CategoryController');	
		Route::resource('system','SystemController');

		
		Route::resource('depart',    'DepartController');
		Route::post('depart/import', 'DepartController@import');
		Route::post('depart/bath-del','DepartController@bathDel');
		Route::get('depart-export','DepartController@export');	

		
		

		Route::prefix('wechat')->group(function(){
			Route::get('wxuser/pull',  'WxuserController@pull');
			Route::get('wxuser/import',  'WxuserController@import');
			Route::post('wxuser/save-user','WxuserController@saveToUser');
			Route::post('wxuser/save-client','WxuserController@saveToClient');
			Route::resource('wxuser',  'WxuserController');
			
			
			
			Route::get('msgtpl',     'MsgtplController@index');
			Route::get('msgtpl-show/{tpl_key}','MsgtplController@show');
			Route::get('msgtpl-edit/{tpl_key}','MsgtplController@edit');
			Route::post('msgtpl-save',         'MsgtplController@save');
			Route::get('msgtpl-del/{tpl_key}', 'MsgtplController@del');
			Route::get('msgtpl-import','MsgtplController@import');
			Route::get('msgtpl-all','MsgtplController@all');
			Route::get('menu','WxMenuController@index');

			// 素材管理
			Route::any('get-material','WxMaterialController@getMaterial');

			Route::get('material-downvideo','WxMaterialController@downVideo');

			// 发送消息到个人
			Route::any('send-msg','WxMsgController@sendMsg');
		});


		Route::resource('articles',   'ArticleController');
		

		// 统计报表
		Route::prefix('census')->group(function(){
			Route::any('worker-count','CensusController@workerCount');
			Route::any('worker-count-export','CensusController@workerCountExport');
		});

		// 服务信息
		Route::resource('notice','NoticeController');
		Route::resource('worklog','WorklogController');
		Route::resource('worker','WorkerController');

		
		//退单 
		Route::post('refund','IndexController@refund');

		//派工
		Route::post('process','IndexController@process');

		// 租赁信息
		Route::get('rent/export',	'RentController@export');
		Route::resource('rent',		'RentController');

		// 租赁记录
		Route::resource('rent-log', 'RentLogController');

		//后台首页
		Route::get('/',		   'IndexController@index');
		
	});
		Route::get('login',    'LoginController@login');
		Route::post('logindo', 'LoginController@loginDo');
		Route::get('logout',   'LoginController@logOut');
		
	
});






